//数据字典API

import service from "@/utils/request";

/*
 * 多个字典明细查询
 * @param  types:[] 传入需要查询的types 数组格式可以传多个
 * @return [] 返回查询列表
 * @author hailun 2021/10/03
 */
export const find = (data) => {
  return service({
    url: "/dictionary/find",
    method: "post",
    data,
  });
};

/*
 * 单个字典明细查询
 * @param  types
 * @return [] 返回查询列表
 * @author hailun 2021/10/03
 */
export const first = (params) => {
  return service({
    url: "/dictionary/first",
    method: "get",
    params,
  });
};
/*
 * 获取行政区
 * @param  types
 * @return [] 返回获取行政区
 * @author hailun 2021/10/03
 */
export const division = (params) => {
  return service({
    url: "/dictionary/division",
    method: "get",
    params,
  });
};


/*
 * 分页查询字典一级数据
 * @param  分页参数
 * @return [] 返回查询列表
 * @author hailun 2021/10/03
 */
export const getList = (params) => {
  return service({
    url: "/dictionary/getList",
    method: "get",
    params,
  });
};

/*
 * 分页查询字典二级数据
 * @param  分页参数
 * @return [] 返回查询列表
 * @author hailun 2021/10/03
 */
export const getDetailsByList = (params) => {
  return service({
    url: "/dictionary/details/getList",
    method: "get",
    params,
  });
};

/*
 * 字典详情创建
 * @param  data
 * @return code = 0
 * @author hailun 2021/10/03
 */
export const detailCreate = (data) => {
  return service({
    url: "/dictionary/details/create",
    method: "post",
    data,
  });
};

/*
 * 字典详情update
 * @param  data
 * @return code = 0
 * @author hailun 2021/10/03
 */
export const detailUpdate = (data) => {
  return service({
    url: "/dictionary/details/update",
    method: "put",
    data,
  });
};

/*
 * 字典详情delete
 * @param  {}
 * @return code = 0
 * @author hailun 2021/10/03
 */
export const detailDelete = (data) => {
  return service({
    url: "/dictionary/details/delete",
    method: "delete",
    data,
  });
};

/*
 * 一级字典创建
 * @param  data
 * @return code = 0
 * @author hailun 2021/10/03
 */
export const create = (data) => {
  return service({
    url: "/dictionary/create",
    method: "post",
    data,
  });
};

/*
 * 一级字典update
 * @param  data
 * @return code = 0
 * @author hailun 2021/10/03
 */
export const update = (data) => {
  return service({
    url: "/dictionary/update",
    method: "put",
    data,
  });
};